﻿package src {
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.system.*;
	import flash.text.*;
	
	import org.papervision3d.objects.*;
	import org.papervision3d.objects.primitives.*
	import org.papervision3d.materials.*;
	import org.papervision3d.materials.special.*;
	import org.papervision3d.core.geom.*;
	import org.papervision3d.core.geom.renderables.*;
	
	public final class Debug extends DisplayObject3D {
		//Debug output, kevin 2009
		public static function show(str:Object = null):void {
			var lc:LocalConnection = new LocalConnection();
			lc.addEventListener(StatusEvent.STATUS, function(e:Event):void{});
			var s:String = "("+ Math.round(System.totalMemory/1000)/1000 +"M) "+str.toString();
			trace(s);
			lc.send("_debug_lc", "Trace", s);
		}
		
		public function Debug():void {
			draw();
			CP.addEventListener(E.RESIZE,resizeHandler);
		}
		
		private function draw():void {
			var size:Number = 500;
			var line:Lines3D = new Lines3D();
            var mateX:LineMaterial = new LineMaterial(0xff0000);
            var mateY:LineMaterial = new LineMaterial(0x00ff00);
            var mateZ:LineMaterial = new LineMaterial(0x0000ff);
            var lineX:Line3D = new Line3D(line, mateX, 2, new Vertex3D(-size, 0, 0), new Vertex3D(size, 0, 0));
            var lineY:Line3D = new Line3D(line, mateY, 2, new Vertex3D(0, -size, 0), new Vertex3D(0, size, 0));
            var lineZ:Line3D = new Line3D(line, mateZ, 2, new Vertex3D(0, 0, -size), new Vertex3D(0, 0, size));
            line.addLine(lineX);
            line.addLine(lineY);
            line.addLine(lineZ);
            line.useOwnContainer = true;
            addChild(line);
		}
		
		private function resizeHandler(e:E=null):void {
			
			
			
		}
		
		
	}
	
}
